package demo.blog.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;

@Data
public class User implements Serializable {
    private Integer id;
    @NotEmpty(message = "邮箱不能为空")
    @Email(message = "邮箱格式错误")
    private String email;
    @NotEmpty(message = "密码不能为空")
    //@Min(value = 8,message = "密码简单")
    private String password;
    private String salt;
    private String nickname;
    private boolean isDelete;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createDate;
    private Integer roleId;

    private Role role;

    public String getCredentialsSalt() {
        return email+salt;
    }
}